package com.md.strategy.impl.format;

import com.md.strategy.ValueFormatter;

import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * @author 刘骄阳
 * 2024-02-07 11:12
 */
public final class BigDecimalFormatter implements ValueFormatter<BigDecimal> {
  public static final BigDecimalFormatter INSTANCE = new BigDecimalFormatter();

  private BigDecimalFormatter() {
  }

  @Override
  public String format(final BigDecimal value) {
    return String.valueOf(value.setScale(2, RoundingMode.HALF_UP));
  }
}
